import React from 'react';
import ReactDOM from 'react-dom';
import './index.scss';
import Login from "./views/login/Login";
import Home from "./views/home/Home";
import {BrowserRouter, Redirect, Route, Switch} from "react-router-dom";
import State from "./state/state";
import SignUp from "./views/signup/SignUp";


ReactDOM.render(
  <BrowserRouter>
      <Switch>
          <Route exact path={'/login'} component={Login}/>
          <Route exact path={'/signup'} component={SignUp}/>
          <Route path="/"
                 render={() => {
                     if (!State.isLogin) return <Redirect to="/login" />;
                     return <Home />;
                 }}/>
      </Switch>
  </BrowserRouter>,
  document.getElementById('root')
);

